// 版权归 瞄你个汪 所有。使用本代码应遵守相关法律法规和Apache 2.0开源许可要求。
package top.geeke.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import top.geeke.entity.base.EntityBaseId;
import top.geeke.toolkit.supertable.annotation.SuperColumn;
import top.geeke.toolkit.supertable.annotation.SuperIndex;
import top.geeke.toolkit.supertable.annotation.SuperTable;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 系统行政地区表
 * </p>
 * @author 瞄你个汪
 * @since 2024-05-01 12:00:00
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "sys_region")
@SuperTable(value = "系统行政地区表", isSystem = true, indexes = {
        @SuperIndex(indexName ="sys_index_{table}_N", indexFields ="regionName"),
        @SuperIndex(indexName ="sys_index_{table}_C", indexFields ="regionCode"),
})
public class SysRegion extends EntityBaseId implements Serializable {
    private static final long serialVersionUID = 1L;

    @SuperColumn(value = "父ID")
    private Long pId;

    @SuperColumn(value = "名称", length = 128)
    private String regionName;

    @SuperColumn(value = "层级")
    private Integer level;

    @SuperColumn(value = "简称", nullable = true, length = 32)
    private String shortName;

    @SuperColumn(value = "组合名", nullable = true, length = 64)
    private String mergerName;

    @SuperColumn(value = "行政代码", nullable = true, length = 32)
    private String regionCode;

    @SuperColumn(value = "邮政编码", nullable = true, length = 6)
    private String zipCode;

    @SuperColumn(value = "区号", nullable = true, length = 6)
    private String cityCode;

    @SuperColumn(value = "拼音", nullable = true, length = 128)
    private String pinYin;

    @SuperColumn(value = "经度", nullable = true)
    private float lng;

    @SuperColumn(value = "维度", nullable = true)
    private float lat;

    @JsonIgnore
    @JsonIgnoreProperties
    @TableField(exist = false)
    private SysRegion parentRegion;

    @JsonIgnore
    @JsonIgnoreProperties
    @TableField(exist = false)
    private List<SysRegion> children;
}
